package com.fjnldx.mes.domain.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.thymeleaf.util.StringUtils;


@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class SchedulingPersonnel extends Model<SchedulingPersonnel> {


    @TableId(value = "id", type = IdType.AUTO)
//	@ApiModelProperty(name = "id" , value = "")
    @JsonIgnore
    private Integer id;

    @ApiModelProperty(name = "name", value = "")
    private String name;

    @ApiModelProperty(name = "gh", value = "")
    private String gh;

    @ApiModelProperty(name = "group", value = "")
    @TableField("`group`")
    private String group;

    @ApiModelProperty(name = "org", value = "")
    private String org;

    @ApiModelProperty(name = "cj", value = "")
    private String cj;

    @ApiModelProperty(name = "gongxu", value = "")
    private String gongxu;

    @ApiModelProperty(name = "workType", value = "")
    @TableField("`work_type`")
    private String workType;

    @ApiModelProperty(name = "bc", value = "")
    private String bc;

    @ApiModelProperty(name = "sex", value = "")
    private String sex;

    @ApiModelProperty(name = "head_img", value = "")
    private String head_img;

    public String saveCheck() {
        StringBuilder sb = new StringBuilder();
        if (StringUtils.isEmpty(this.getName())) {
            sb.append("  人员名不能为空");
        }
        if (StringUtils.isEmpty(this.getGh())) {
            sb.append("  工号不能为空");
        }
        if (StringUtils.isEmpty(this.getGroup())) {
            sb.append("  集团不能为空");
        }
        if (StringUtils.isEmpty(this.getOrg())) {
            sb.append("  组织不能为空");
        }
        if (StringUtils.isEmpty(this.getCj())) {
            sb.append("  车间不能为空");
        }
        if (StringUtils.isEmpty(this.getGongxu())) {
            sb.append("  工序不能为空");
        }
        if (StringUtils.isEmpty(this.getWorkType())) {
            sb.append("  工种不能为空");
        }
        if (StringUtils.isEmpty(this.getBc())) {
            sb.append("  班次不能为空");
        }
        if (StringUtils.isEmpty(this.getSex())) {
            sb.append("  性别不能为空");
        }
        return sb.toString();
    }

    public String updateCheck() {
        StringBuilder sb = new StringBuilder();
        if (StringUtils.isEmpty(this.getGh())) {
            sb.append("  工号不能为空");
        }
        return sb.toString();
    }

}
